<!DOCTYPE html>
<html>

<head>
    <title>{$category.name|default="豪车租赁列表"} {$category.seo_title} - {$site_info.site_name|default=''}</title>
    <meta name="keywords" content="{$category.seo_keywords},{$site_info.site_seo_keywords|default=''}" />
    <meta name="description" content="{$category.seo_description},{$site_info.site_seo_description|default=''}">
    <include file="public@head" />
    <hook name="before_head_end" />
    <link href="__TMPL__/public/assets/css/slippry/slippry.css" rel="stylesheet">
</head>

<body class="body-black">
    <include file="public@nav" />
    <notempty name="theme_vars.rental_top_banner">
        <div class="top-banner"><img src="/upload/{$theme_vars.rental_top_banner}"></div>
        <else/>
        <div class="text-center"><b>请在后台设置模版顶部banner图</b></div>
    </notempty>
    <div class="container tc-main">
        <eq name="ACTION_NAME" value="reserve">
            <div class="text-center">
                <div style="margin-bottom: 40px;">
                    <h1 class="title">豪车预定服务</h1>
                    <h3 class="sub_title">RESERVE</h3>
                </div>
                <div class="info-tab text-center">
                    <a href="{:cmf_url('rental/List/index',array( 'id'=>$category.id))}"><span>品牌选择</span></a>
                    <a href="{:cmf_url('rental/Car/reserve',array('cid'=>$category.id))}"> <span class="action">预定服务</span></a>
                </div>
                <div class="clearboth"></div>
            </div>
            <div class="row" style="margin-top:65px;">
                <div class="col-md-6">
                    <widget name="reserve">
                        <div class="reserve-box text-center">
                            <img src="<notempty name='widget.vars.reserve_banner'>/upload/</notempty>{$widget.vars.reserve_banner|default='__TMPL__/public/assets/images/echehui/reserve_banner.png'}">
                            <div class="reserve_title"> {$widget.vars.reserve_title}</div>
                            <div class="reserve_content"><pre>{$widget.vars.reserve_content}</pre></div>
                        </div>

                    </widget>
                </div>
                <div class="col-md-6">
                    <form class="form-horizontal form-reserve ajax-form" action="{:cmf_url('rental/Car/reserve')}" method="post" novalidate="novalidate">
                        <div class="form-group row">
                            <label class="col-md-4 control-label">车辆品牌 | BRAND</label>
                            <div class="col-md-8 no-padding">
                                <input class="form-control" name="brand" value="{$car.brands.name}" type="text">
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-4 control-label">车辆型号 | MODEL</label>
                            <div class="col-md-8 no-padding">
                                <input class="form-control" type="text" name="model" value="{$car.car_model}">
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-4 control-label">车辆颜色 | COLOR</label>
                            <div class="col-md-8 no-padding">
                                <input class="form-control" type="text" name="color" value="{$car.primary.exterior}">
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-9 control-label">是否接受颜色调换 | COLOR</label>
                            <div class="col-md-3  reserve-l-input">
                                <input value="1" name="change_color" type="radio" checked>是
                                <input value="2" name="change_color" type="radio">否
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-5 control-label">使用方式 | USE</label>
                            <div class="col-md-7 no-padding reserve-l-input">
                                <input value="1" name="use_type" type="radio" checked>自驾
                                <input value="2" name="use_type" type="radio">婚庆
                                <input value="3" name="use_type" type="radio">商务
                                <input value="4" name="use_type" type="radio">展示
                                <input value="5" name="use_type" type="radio">其它
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-4 control-label">姓名 | NAME *</label>
                            <div class="col-md-8 no-padding">
                                <input class="form-control" type="text" name="name">
                            </div>
                        </div>
                        <div class="form-group  row">
                            <label class="col-md-5 control-label">联系电话 | TELEPHONE *</label>
                            <div class="col-md-7 no-padding">
                                <input class="form-control" type="tel" name="telephone">
                            </div>
                        </div>
                        <div class="form-group row">
                            <input name="car_id" value="{$car.id|default=0}" type="hidden">
                            <button class="btn btn-reserve btn-block js-ajax-submit" type="submit" style="margin-left: 0px" data="提 交 | SUBMIT">
                            提 交 | SUBMIT</button>
                        </div>
                        <div class="reserver-msg">
                            <div class="title">{$Think.server.HTTP_HOST} 提示</div>
                            <div class="reserve-close-btn" onclick="hideMsg()"></div>
                            <div class="reserve-show-msg">您输入的电话号码有误</div>
                            <div class="reserve-confirm-btn" onclick="hideMsg()">确定</div>
                        </div>
                    </form>
                    <script type="text/javascript" src="/static/js/ajaxForm.js?v="></script>
                    <script>
                        $('form.ajax-form').ajaxForm({
                            beforeSubmit: ajaxFormBeforeSubmit,
                            success: ajaxFormComplete,
                            type: $(this).attr('method'),
                            dataType: 'json',
                            target: '#output'
                        });
                        /*ajaxFormBeforeSubmit*/
                        function ajaxFormBeforeSubmit(obj, $form) {
                            $form.find(":submit").addClass('disabled').prop('disabled', true);
                            $form.find(":submit").text('提交中...');
                        }
                        /*ajaxFormComplete 请求成功函数*/
                        function ajaxFormComplete(data) {
                            var $form = $('form.ajax-form');
                            $form.find(':submit').removeClass('disabled').prop('disabled', false);
                            $form.find(":submit").text($form.find(":submit").attr('data'));
                            if (data.code == 0) {
                                showMsg(data);

                                return false;
                            } else {
                                showMsg(data);
                                setTimeout(function() {
                                    if (data.url) {
                                        location.href = data.url;
                                    } else {
                                        location.href = window.location;
                                    }
                                }, data.wait * 500);

                            }
                        }


                        function showMsg(data) {
                            //$(".reserver-msg")
                            $(".reserver-msg").find('.reserve-show-msg').text(data.msg);
                            $(".reserver-msg").slideDown(300);
                        }

                        function hideMsg() {
                            $(".reserver-msg").find('.reserve-show-msg').text('');
                            $(".reserver-msg").slideUp(300);
                        }
                    </script>
                </div>


            </div>
            <hr class="no-margin clearboth" style="margin-top:60px;">
            <else/>
            <notempty name="brands">
                <div class="text-center">
                    <div style="margin-bottom: 40px;">
                        <h1 class="title">豪车品牌选择</h1>
                        <h3 class="sub_title">SELECT</h3>
                    </div>
                    <div class="info-tab text-center">
                        <a href="{:cmf_url('rental/List/index',array('id'=>$category.id))}"><span class="action">品牌选择</span></a>
                        <a href="{:cmf_url('rental/Car/reserve',array('cid'=>$category.id))}"> <span>预定服务</span></a>
                    </div>
                    <div class="clearboth"></div>
                    <ul class="rental-select no-padding">
                        <volist name="brands" id="vo">
                            <in name="vo.id" value="$rental_brands">
                                <li>
                                    <a href="{:url('rental/List/index',array( 'id'=>$category.id,'brand'=>$vo.id))}">

                                        <img src="{:cmf_get_image_preview_url($vo.icon)}" title="{$vo.name}" <notempty name="brand.id"> {$brand.id==$vo.id?'class="active"':' '}
            </notempty>/>
            </a>
            </li>
            </in>

            </volist>
            <div class="clearboth"></div>
            </ul>
            <div class="rental-select-close"><span class="select-open">选择品牌</span></div>
            <script>
                $('.rental-select-close span').click(function() {
                    if ($(this).attr('class') == 'select-open') {
                        $(".rental-select").slideUp(300);
                        $(this).attr('class', 'select-close');
                    } else {
                        $(".rental-select").slideDown(300);
                        $(this).attr('class', 'select-open');
                    }
                });
            </script>
            </div>
            </notempty>
            <div class="text-center">
                <div style="margin-top: 80px;">
                    <h1 class="title">最新车型推荐</h1>
                    <h3 class="sub_title">RECOMMEND</h3>
                </div>
                <div class="row">
                    <php>
                        $brand_where =""; empty($brand['id'])|| $brand_where['brand_id']=['eq',$brand['id']];
                    </php>
                    <div class="row no-margin">
                        <rental:cars where="$brand_where" limit="3" order="update_time DESC" categoryIds="$category.id">
                            <div class="col-md-4 car-box">
                                <div class="tc-gridbox rental-tc-gridbox">
                                    <a href="{:cmf_url( 'rental/Car/index',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}">
                                        <div class="header">
                                            <div class="item-image">
                                                <present name="vo.more.thumbnail">
                                                    <empty name="vo.more.thumbnail">
                                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png" class="img-responsive" alt="">
                                                        <else/>
                                                        <img src="{:cmf_get_image_url($vo.more.thumbnail)}" class="img-responsive" alt="">
                                                    </empty>
                                                    <else/>
                                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png" class="img-responsive" alt="">
                                                </present>
                                            </div>
                                            <h3 class="title rental-title">
                                                {$vo.title}
                                            </h3>
                                            <div class="title price rental-price">
                                                <span class="now-price">一口价：{$vo.primary.price}万</span>&nbsp;&nbsp;&nbsp;<span class="m-price">市场价：{$vo.primary.m_price}万</span>
                                            </div>
                                        </div>
                                    </a>

                                </div>
                                <div class="text-left">
                                    <a href="{:cmf_url('rental/Car/index',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}"><span>查看详情></span></a><a href="{:cmf_url('rental/Car/reserve',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}"><span>在线预定></span></a>
                                </div>
                            </div>
                        </rental:cars>
                    </div>
                </div>
            </div>
            <hr class="no-margin" style="margin-top:60px;">
            <div class="text-center">
                <div style="margin-top: 60px;">
                    <h1 class="title">全部车型</h1>
                    <h3 class="sub_title">ALL MODELS</h3>
                </div>
                <div class="row">

                    <div class="row no-margin">
                        <empty name="cars">
                            <hr class="no-margin clearboth" style="margin-top:60px;">
                            <div class="text-center lose">没有找到您想要到，看看别的吧！</div>
                        </empty>
                        <volist name="cars" id="vo">
                            <div class="col-md-4 car-box">
                                <div class="tc-gridbox rental-tc-gridbox">
                                    <a href="{:cmf_url( 'rental/Car/index',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}">
                                        <div class="header">
                                            <div class="item-image">
                                                <present name="vo.more.thumbnail">
                                                    <empty name="vo.more.thumbnail">
                                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png" class="img-responsive" alt="">
                                                        <else/>
                                                        <img src="{:cmf_get_image_url($vo.more.thumbnail)}" class="img-responsive" alt="">
                                                    </empty>
                                                    <else/>
                                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png" class="img-responsive" alt="">
                                                </present>
                                            </div>
                                            <h3 class="title rental-title">
                                                {$vo.title}
                                            </h3>
                                            <div class="title price rental-price">
                                                <span class="now-price">一口价：{$vo.primary.price}万</span>&nbsp;&nbsp;&nbsp;<span class="m-price">市场价：{$vo.primary.m_price}万</span>
                                            </div>
                                        </div>
                                    </a>

                                </div>
                                <div class="text-left">
                                    <a href="{:cmf_url('rental/Car/index',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}"><span>查看详情></span></a><a href="{:cmf_url('rental/Car/reserve',array( 'id'=>$vo.id,'cid'=>$vo.category_id))}"><span>在线预定></span></a>
                                </div>
                            </div>
                        </volist>
                    </div>
                    <div class="text-center">
                        <ul class="pagination">{$page|default=''}</ul>
                    </div>
                </div>
            </div>
        </eq>
    </div>

    <include file="public@footer" />
    <include file="public@scripts" />
    <script src="__TMPL__/public/assets/js/slippry.min.js "></script>
    <script>
        $(function() {
            $("#news-slippry ").slippry({
                transition: 'fade',
                useCSS: true,
                pagerClass: 'news-sy-pager',
                captions: false,
                speed: 1000,
                pause: 3000,
                auto: true,
                preload: 'visible'
            });

        });
        $('.list-select li a').click(function() {
            var url = $('.select-form').attr('action');
            var select = $(this).attr('select');
            var data = $(this).attr('data');
            $('.select-form').find('input[name=' + select + ']').val(data);
            var query = $('.select-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            //console.log(url);
            console.log(query);
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            console.log(url);
            window.location.href = url;
            // alert($(this).attr('elect-data'));
        });
    </script>

    <hook name="before_body_end" />
</body>

</html>